#!/usr/bin/env node

/**
 * Claude Flow CLI - AI-Driven Development Toolkit
 * 
 * This is the main entry point for the Claude Flow command-line interface.
 * It provides powerful AI coordination capabilities for Claude Code.
 */

const { spawn } = require('child_process');
const path = require('path');

// Resolve the actual CLI path
const cliPath = path.resolve(__dirname, 'dist', 'index.js');

// Forward all arguments to the actual CLI
const child = spawn(process.execPath, [cliPath, ...process.argv.slice(2)], {
  stdio: 'inherit',
  env: {
    ...process.env,
    CLAUDE_FLOW_CLI: 'true'
  }
});

// Forward the exit code
child.on('exit', (code) => {
  process.exit(code);
});

// Handle errors
child.on('error', (err) => {
  console.error('Failed to start Claude Flow:', err);
  process.exit(1);
});